# -*- coding:utf8 -*-

from Score import Score
from Main import Main

class Population:
    """Population
    """

    # Attributes:
    __listeIndividu =  {}  # (List <Individu>)
    __scores = {}
    __scoreInstance = None
    __ADN = None
    __ADNBrin = None
    
    # Operations
    def __init__(self):
        """function Population
        
        returns 
        """
        self.__scoreInstance = Score()
        self.__ADN = Main(self.__scoreInstance)

    def getPop(self):
        return self.__listeIndividu

    def addIndividu(self, in_individu):
        # @type in_individu Individu
        if len(self.__listeIndividu.keys()) == 0:
            id = 0
        else:
            id = max(self.__listeIndividu.keys()) + 1
        in_individu.setId(id)
        self.__listeIndividu.append(in_individu)

    def getScore(self, in_id, score):
        if self.__scores.has_key(in_id):
            if self.__scores[in_id].has_key(score):
                return self.__scores[in_id][score]
        else:
            brin = self.__ADN.parse(self.__ADNBrin)
            separed = self.__ADN.separe(brin)
            AA = self.__ADN.searchForAA(separed)
            print AA
